package com.ymatou.query.trading.api.testcase;

import java.math.BigDecimal;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.experimental.categories.Category;

import com.ymatou.query.trading.api.parameter.GetCouponInfoListBean;
import com.ymatou.query.trading.api.service.GetCouponInfoListCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.common.enums.PlatformEnum;
import com.ymttest.utils.constant.ECode;

/**
 * 查询用户可使用的优惠券列表 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_GetCouponInfoList {

	private static GetCouponInfoListBean getcouponinfolistbean;
	private static GetCouponInfoListCall getcouponinfolistcall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("查询用户可使用的优惠券列表");
	}

	@Before
	public void caseUp() {

		getcouponinfolistbean = new GetCouponInfoListBean();
		getcouponinfolistcall = new GetCouponInfoListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getcouponinfolistcall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	//@Test 废弃
	@Category(P1.class)
	@TestCase
	public void Tc_GetCouponInfoList_001() {
		Logger.start(true,"查询用户可使用的优惠券列表成功");
		try {
			// 参数
			BigDecimal Amount = new BigDecimal(100);
			getcouponinfolistbean.setAmount(Amount);
			getcouponinfolistbean.setBuyerId(1113);
			getcouponinfolistbean.setSellerId(288484);
			getcouponinfolistbean.setSource(1);
			getcouponinfolistbean.setUsePlatform(PlatformEnum.Ymt_APP);
			// 发送请求
			getcouponinfolistcall.setData(getcouponinfolistbean);
			getcouponinfolistcall.callService();
			Logger.comment("getcouponinfolistcall send:" + getcouponinfolistcall.getEntityString());
			Logger.comment("getcouponinfolistcall response:" + getcouponinfolistcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getcouponinfolistcall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			// getcouponinfolistcall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

}